//
//  CYTopTitleCollectionViewCell.m
//  CYTabBarViewController
//
//  Created by lc4y on 2017/12/4.
//  Copyright © 2017年 weiwang. All rights reserved.
//

#import "CYTopTitleCollectionViewCell.h"
#import "CYTabBar.h"

@interface CYTopTitleCollectionViewCell ()

@end

@implementation CYTopTitleCollectionViewCell

- (void)refreshCollectionCell:(id)viewCModel titleView:(CYTitleView *)titleView{
    UIViewController *viewController = viewCModel;
    
    [self.titleButton setTitleColor:titleView.cy_titleNormalColor forState:UIControlStateNormal];
    [self.titleButton setTitleColor:titleView.cy_titleSelectedColor forState:UIControlStateSelected];
    self.titleButton.titleLabel.font = titleView.cy_titleFont;
    [self.titleButton setTitle:viewController.cy_tabBarItem.cy_titleN forState:UIControlStateNormal];
    
    if (titleView.cy_TopStyle == CYTopTitleViewStyleBGColor) {
        self.buttonBGView.backgroundColor = titleView.cy_normalBGColor;
        self.buttonBGView.layer.cornerRadius = 17;
        self.buttonBGView.layer.masksToBounds = YES;
    }
    
    if( viewController.cy_tabBarItem.cy_normalImageN ) {
        [self.titleButton setImage:[UIImage imageNamed:viewController.cy_tabBarItem.cy_normalImageN] forState:UIControlStateNormal];
        [self.titleButton layoutButtonWithEdgeInsetsStyle:titleView.cy_buttonEdgeInsetsStyle imageTitleSpace:5];
    }
    
    if( viewController.cy_tabBarItem.cy_selectedImageN ) {
        [self.titleButton setImage:[UIImage imageNamed:viewController.cy_tabBarItem.cy_selectedImageN] forState:UIControlStateSelected];
    }
    
}

@end
